import { SocketRespWrap } from "../../core/module/socket/BaseTypes";
import { Protocol } from "../../proto/msg";
import { app } from "../app/App";


export class LobbyModel {
    /**
     * 匹配房间
     */
    matchRoomReq(callback?) {
        app.net.sendData(Protocol.GAME_MATCH_ROOM, { kindId: 100}, (resp: SocketRespWrap) => {
            if (resp.code == proto.CODE.SUCCESS) {
                const data = resp.body as proto.Room
                app.model.game.saveRoomInfo(data.roomId, data.kindId)
                console.log("登录成功")
                callback && callback()
            }
            else app.toast.showAlert("进入房间失败 system code: " + resp.code)
        })
    }
}


